package com.itfreer.power.service.organize;

import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.itfreer.form.api.BaseDao;
import com.itfreer.form.api.imp.DictionaryServiceImp;
import com.itfreer.form.dictionary.base.DictionaryItem;
import com.itfreer.power.dao.organize.AdministrativeDao;
import com.itfreer.power.entity.organize.AdministrativeEntity;

/**
 * 定义政区服务
 */
@Component("administrativeService")
public class AdministrativeServiceBase extends DictionaryServiceImp<AdministrativeEntity> implements AdministrativeService {
	
	@Autowired
	private AdministrativeDao administrativeDao;

	@Override
	protected BaseDao<AdministrativeEntity> getDao() {
		return administrativeDao;
	}
	
	@Override
	public String getDictionaryName() {
		return "p_administrative";
	}

	@Override
	protected DictionaryItem convert(AdministrativeEntity entity) {
		DictionaryItem toEntity = new DictionaryItem();
		BeanUtils.copyProperties(entity, toEntity);
		return toEntity;
	}

	@Override
	protected String getDictionaryFields() {
		return "id,pid,code,display,valid,leaf,order";
	}
}
